<template>
  <div class="goodsDesc-container">
    <h3 class="goodsTitle">{{ goodsDesc.title }}</h3>
    <hr>
    <!-- 图文内容 -->
    <div v-html="goodsDesc.content" class="goodsContent"></div>
  </div>
</template>


<script>
export default {
  data: function() {
    return {
      id: this.$route.params.id, //保存url地址上的id
      goodsDesc: {}
    };
  },
  created() {
    // 调用获取数据的函数
    this.getGoodsDesc();
  },
  methods: {
    getGoodsDesc() {
      this.$http.get("api/goods/getdesc/" + this.id).then(result => {
        if (result.body.status == 0) {
          console.log(result.body.message[0]);
          this.goodsDesc = result.body.message[0];
        }
      });
    }
  }
};
</script>


<style lang="scss" >
.goodsDesc-container {
  margin: 0 5px;
  .goodsTitle {
    font-size: 16px;
    color: red;
    text-align: center;
    font-weight: bold;
  }
  .goodsContent {
    img {
      width: 100%;
    }
  }
}
</style>

